From b5836f71e186c891231def53b415b3f340306613 Mon Sep 17 00:00:00 2001 From: Chong Li Date: Wed, 6 Apr 2016 15:30:38 -0500 Subject: [PATCH] libxc: fix uninitialized variable when changing rtds scheduling parameters Commit 046c2b503a89d21b41e4d555a9f75d02af00dbc6 introduces a build failure: in some cases (e.g., num_vcpus <=0), xc_sched_rtds_vcpu_get/set returns an uninitialized variable. Fix it. Reported-by: Andrew Cooper Signed-off-by: Chong Li Reviewed-by: Andrew Cooper --- tools/libxc/xc_rt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libxc/xc_rt.c b/tools/libxc/xc_rt.c index 221d17fa7c..77aaa36ae1 100644 --- a/tools/libxc/xc_rt.c +++ b/tools/libxc/xc_rt.c @@ -68,7 +68,7 @@ int xc_sched_rtds_vcpu_set(xc_interface *xch, struct xen_domctl_schedparam_vcpu *vcpus, uint32_t num_vcpus) { - int rc; + int rc = 0; unsigned processed = 0; DECLARE_DOMCTL; DECLARE_HYPERCALL_BOUNCE(vcpus, sizeof(*vcpus) * num_vcpus, @@ -102,7 +102,7 @@ int xc_sched_rtds_vcpu_get(xc_interface *xch, struct xen_domctl_schedparam_vcpu *vcpus, uint32_t num_vcpus) { - int rc; + int rc = 0; unsigned processed = 0; DECLARE_DOMCTL; DECLARE_HYPERCALL_BOUNCE(vcpus, sizeof(*vcpus) * num_vcpus, -- 2.30.2